package cn.saltybe.analysis.crawler.wbtc.shareRentingHouse;

import cn.saltybe.analysis.crawler.wbtc.common.WbtcHouseImage;
import com.geccocrawler.gecco.annotation.*;
import com.geccocrawler.gecco.request.HttpRequest;
import com.geccocrawler.gecco.spider.SpiderBean;

import java.util.List;

@Gecco(
        matchUrl = {
                "https://{}.58.com/hezu/{id}x.shtml",
                "https://{}.58.com/hezu/{id}x.shtml%3FhouseId={}&shangquan={}&shangquanId={}&dataSource={}&tid={}&legourl=//legoclick.58.com/jump%3Ftarget={}"
        },
        pipelines = { "wbtcShareRentingHousePipeline" },
        downloader = "htmlUnitDownloader")
public class WbtcShareRentingHouse implements SpiderBean {
    @Request
    private HttpRequest request;

    public HttpRequest getRequest() {
        return request;
    }

    public void setRequest(HttpRequest request) {
        this.request = request;
    }

    @RequestParameter
    private String id;

    @Text
    @HtmlField(cssPath = "body > div.main-wrap > div.house-title > h1")
    private String title;

    @Text
    @HtmlField(cssPath = "body > div.main-wrap > div.house-basic-info > div.house-basic-right.fr > div.house-basic-desc > div.house-desc-item.fl.c_333 > div > span.c_ff552e > b")
    private String price;

    @Text
    @HtmlField(cssPath = "body > div.main-wrap > div.house-basic-info > div.house-basic-right.fr > div.house-basic-desc > div.house-desc-item.fl.c_333 > ul > li:nth-child(5) > span:nth-child(2) > a:nth-child(1)")
    private String district;

    @Text
    @HtmlField(cssPath = "span.dz")
    private String address;

    @Image
    @HtmlField(cssPath = "#leftImg > li")
    private List<WbtcHouseImage> image;

    @Text
    @HtmlField(cssPath = "body > div.main-wrap > div.house-basic-info > div.house-basic-right.fr > div.house-basic-desc > div.house-desc-item.fl.c_333 > ul > li:nth-child(2) > span.strongbox")
    private String type;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getDistrict() { return district; }

    public void setDistrict(String district) { this.district = district; }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public List<WbtcHouseImage> getImage() {
        return image;
    }

    public void setImage(List<WbtcHouseImage> image) {
        this.image = image;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}
